<style type="text/css">
    .toptips{
        font-size: 12px;
        font-weight: bold;
    }
    .vis-personimg-box{
        width: 120px;
        max-height: 120px;
        border-radius: 6px;
        overflow: hidden;
        margin:0 auto;
    }
    .vis_personimg{
        
        width: 120px;
    }

</style>
{php}
{//var_dump($data);}
{/php}
<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body margin-left-10">
        <div class="layui-row">

    <div class="layui-col-md3 text-center">
<!--               <div class="layui-col-xs6 text-center">
                    <img data-tips-image src="http://pc.zsicp.com/static/theme/img/headimg.png">
                </div> -->
        <div class="layui-col-md12 toptips">

           <i class="layui-icon">&#xe66f;</i>来访客人信息

        </div>
        <div class="layui-col-md12 margin-top-10">
                <div class="vis-personimg-box">
                    <img data-tips-image class="vis_personimg" src="{$data['vis_uinfo']['personimg']}">
                </div>
        </div>
    </div>


        <div class="layui-col-md9 text-center margin-top-40">

                <div class="layui-form-item">
                   <label class="layui-form-label label-required">访客姓名</label>
                    <div class="layui-input-block">
                        <input readonly value='{$data["vis_uinfo"]["name"]|default=""}' class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                   <label class="layui-form-label label-required">所属公司</label>
                    <div class="layui-input-block">
                        <input readonly value='{$data["vis_uinfo"]["company_name"]|default=""}' class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                   <label class="layui-form-label label-required">联系电话</label>
                    <div class="layui-input-block">
                        <input readonly value='{$data["vis_uinfo"]["mobile"]|default=""}' class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                   <label class="layui-form-label label-required">身份证ID</label>
                    <div class="layui-input-block">
                        <input readonly value=' {php} {echo substr_replace($data["vis_uinfo"]["identitycard"],"*****",8,4);}{/php}' class="layui-input">
                    </div>
                </div>
                  <div class="layui-form-item">
                   <label class="layui-form-label label-required">操作选项</label>
                    <div class="layui-input-block">
                        <button type="button" data-open="{:url('visitor/record/index')}?user_id={$data['vis_uinfo']['id']}&spm=m-70-71-207" data-close data-title="查看访问记录" class='layui-btn layui-btn-sm  layui-btn-normal'>更多访问记录</button>
                    </div>
                </div>


    </div>
        </div>
<div class="margin-top-40"></div>
 <blockquote class="layui-elem-quote">详 情</blockquote>
            <ul class="layui-timeline">
      
            <li class="layui-timeline-item">
              <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
              <div class="layui-timeline-content layui-text">
                <h3 class="layui-timeline-title">{$data['list']['app_visittime']|format_datetime}</h3>
                <p>
                    <h3>事由-{$data['list']['app_reson']}</h3>
                    <h4>备注-{$data['list']['app_remark']}</h4>
                  <p>访问部门:{$data['list']['address']} | 接待人:{$data['list']['app_user_name']}</p>
                  <p>
                     
                    <br>
                    {notempty name="$data['list']['vister_arrivetime']"}
                    <!-- 到达时间 -->预约时间:{$data['list']['vister_arrivetime']|format_datetime}
                    <hr class="layui-bg-red">
                    {/notempty}
                    
                    {notempty name="$data['list']['security_passtime']"}
                    门卫:{$data['list']['security_name']} | 门卫放行时间:{$data['list']['security_passtime']|format_datetime}
                    <hr class="layui-bg-orange">
                    {/notempty}

                    {notempty name="$data['list']['vister_meettime']"}
                    到达访问地点时间:{$data['list']['vister_meettime']|format_datetime}
                    <hr class="layui-bg-green">
                    {/notempty}

                    {notempty name="$data['list']['vister_deptleavetime']"}
                    离开访问地点时间:{$data['list']['vister_deptleavetime']|format_datetime}
                    <hr class="layui-bg-blue">
                    {/notempty}

                    {notempty name="$data['list']['vister_leavetime']"}
                    完成访问离开时间:{$data['list']['vister_leavetime']|format_datetime}
                    <hr class="layui-bg-cyan">
                    {/notempty}
      
                  </p>
                  <hr/>
                  <br>
                    {switch name="$data['list']['status']" }
                        {case value='0'}<a class="layui-btn layui-btn-sm layui-btn-primary">访问未完成</a>{/case}
                        {case value='1'}<a class="layui-btn layui-btn-sm layui-btn-green">访问已完成</a>{/case}
                        {case value='2'}<a class="layui-btn layui-btn-sm layui-btn-warm">访问已逾期</a>{/case}
                        {case value='3'}<a class="layui-btn layui-btn-sm layui-btn-blue">访问已逾期完成</a>{/case}
                        {default  /}-
                    {/switch}
                  <br><i class="layui-icon"></i>
                </p>
              </div>
            </li>
        

  
</ul>

      {empty name='data.nowday_list'}<span class="notdata">暂无更多今天访问记录</span>{/empty}
      <blockquote class="layui-elem-quote">今天访问记录</blockquote>
        <ul class="layui-timeline">
         {foreach $data['nowday_list'] as $key=>$vo}
            <li class="layui-timeline-item">
              <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
              <div class="layui-timeline-content layui-text">
               <h3 class="layui-timeline-title">{$vo.app_visittime|format_datetime}</h3>
                <p>
                    <h3>事由-{$vo.app_reson}</h3>
                    <h4>备注-{$vo.app_remark}</h4>
                  <p>访问部门:{$vo.address} | 接待人:{$vo.app_user_name}</p>
                  <p>
                     
                    <br>
                    {notempty name='vo.vister_arrivetime'}
                    到达时间:{$vo.vister_arrivetime|format_datetime}
                    <hr class="layui-bg-red">
                    {/notempty}
                    
                    {notempty name='vo.security_passtime'}
                    门卫:{$vo.security_name} | 门卫放行时间:{$vo.security_passtime|format_datetime}
                    <hr class="layui-bg-orange">
                    {/notempty}

                    {notempty name='vo.vister_meettime'}
                    到达访问地点时间:{$vo.vister_meettime|format_datetime}
                    <hr class="layui-bg-green">
                    {/notempty}

                    {notempty name='vo.vister_deptleavetime'}
                    离开访问地点时间:{$vo.vister_deptleavetime|format_datetime}
                    <hr class="layui-bg-blue">
                    {/notempty}

                    {notempty name='vo.vister_leavetime'}
                    完成访问离开时间:{$vo.vister_leavetime|format_datetime}
                    <hr class="layui-bg-cyan">
                    {/notempty}
      
                  </p>
                  <hr/>
                  <br>
                    {switch name="vo.status" }
                        {case value='0'}<a class="layui-btn layui-btn-sm layui-btn-primary">访问未完成</a>{/case}
                        {case value='1'}<a class="layui-btn layui-btn-sm layui-btn-green">访问已完成</a>{/case}
                        {case value='2'}<a class="layui-btn layui-btn-sm layui-btn-warm">访问已逾期</a>{/case}
                        {case value='3'}<a class="layui-btn layui-btn-sm layui-btn-blue">访问已逾期完成</a>{/case}
                        {default  /}-
                    {/switch}
                  <br><i class="layui-icon"></i>
                </p>
              </div>
            </li>
          {/foreach}

  
</ul>
    </div>
    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
       <button class="layui-btn layui-btn-danger" type='button'  data-close>关闭</button>
    </div>

    <script>
        var SCOPE = {
        'get_company' : "{:url('company/company/getlist')}",
        'get_appuserlist' : "{:url('company/company/getappuserlist')}",
        'get_getdeptlist' : "{:url('company/company/getdeptlist')}",
        'jump_url' : "{:url('visitor/visitor/index')}",
    
    };


   layui.use('form',function(){

        var form=layui.form;

        console.log(form)

        var tpl_company_options = '<option value=""></option>';
        $.get(SCOPE.get_company,{},function(data,status,xhr){
    
            var companylist = JSON.parse(data)
            console.log(companylist)
            console.log(JSON.parse(data))
            for (var i = 0; i < companylist.data.length; i++) {
                tpl_company_options =   tpl_company_options+'<option value="'+companylist.data[i].id+'">'+companylist.data[i].name+'</option>'
                  
            }
             console.log(tpl_company_options)
            $('#choice_company').html(tpl_company_options)
             form.render('select');
         
        },'JSON')



        form.on('select',function(res){
            console.log(res)
            console.log(res.elem.id)
            // choice_company
        /*获取公司部门列表*/
            if(res.elem.id == 'choice_company'){
                var tpl_dept = '<option value=""></option>';
                $.get(SCOPE.get_getdeptlist,{
                "companyid":res.value

                },function(data,status,xhr){
    
                var deptlist = JSON.parse(data)
                for (var i = 0; i < deptlist.data.length; i++) {
                    tpl_dept = tpl_dept+'<option value="'+deptlist.data[i].id+'">'+deptlist.data[i].name+'</option>'
                }
                $('#choice_dept').html(tpl_dept)
                form.render('select');
                console.log(JSON.parse(data))

         
                },'JSON')
            }

        /*获取公司指定受访人*/
        // choice_appuser
            if(res.elem.id == 'choice_company'){
                var tpl_userapp = '<option value=""></option>';
                $.get(SCOPE.get_appuserlist,{
                 "companyid":res.value
        
                },function(data,status,xhr){
            
                 var appuserlist = JSON.parse(data)
                 for (var i = 0; i < appuserlist.data.length; i++) {
                     tpl_userapp = tpl_userapp+'<option value="'+appuserlist.data[i].id+'">'+appuserlist.data[i].name+'</option>'
                 }
                 $('#choice_appuser').html(tpl_userapp)
                 form.render('select');
        
                 console.log(JSON.parse(data))

         
                },'JSON')
            }
        })

   });


        window.form.render();






</script>

</form>
